package com.wuchao.controller;

import com.wuchao.service.T169Service;
import lombok.Data;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author wuchao66
 * @Date 2023/11/4 10:27
 * @PackageName:com.wuchao.controller
 * @ClassName: OracleController
 * @Description: TODO
 * @Param
 * @Version 1.0
 */
@Controller
public class OracleController {
    @Resource
    private T169Service t169Service;

   @RequestMapping("findT169ById/{id}")
    public String findT169ById(Model model, @PathVariable("id") int id){
        //Create a new map to store the values of the variables
        Map map=new HashMap<String,Object>();
        //Add the id to the map
        map.put("vid",id);
        //Call the findT169ById method from the t169Service
        t169Service.findT169ById(map);
        //Get the value of the vvid variable from the map
        int vvid = (int) map.get("vvid");
        //Get the value of the vname variable from the map
        String vname = (String) map.get("vname");
        //Get the value of the vtime variable from the map
        Date vtime = (Date) map.get("vtime");
        //Add the vvid, vname, and vtime variables to the model
        model.addAttribute("vvid",vvid);
        model.addAttribute("vname",vname);
        model.addAttribute("vtime",vtime);
        //Return the orcl view
        return "orcl";
    }
    @RequestMapping("findT169ById1/{id}")
    public String findT169ById1(Model model, @PathVariable("id") int id){
        Map map=new HashMap<String,Object>();
        map.put("vid",id);
        t169Service.findT169ById1(map);
        int vvid = (int) map.get("vvid");
        String vname = (String) map.get("vname");
        model.addAttribute("vvid",vvid);
        model.addAttribute("vname",vname);
        return "orcl";
    }
}
